<template>
    <div class="pages">
        <van-nav-bar title="退款详情" left-arrow fixed safe-area-inset-top @click-left="onClickLeft"></van-nav-bar>

        <div class="info">
            <div class="info-title">已退款</div>
            <div class="info-flex">
                <div class="info-name">退款金额</div>
                <div class="info-price"><span class="price-icon">¥</span>{{ `${info.refund_price_arr.z_price}.${info.refund_price_arr.x_price}` }}</div>
            </div>
            <div class="info-flex">
                <div class="info-name">退款店铺</div>
                <div class="info-price">{{ info.user_shop_name }}</div>
            </div>
        </div>

        <div class="delivery" >
            <div class="delivery-title">
                <div>退款商品</div>
                <!-- <div class="title-right">
                    <span>采购金额&nbsp;</span>
                    <span class="right-price">¥93</span>
                </div> -->
            </div>
            <div class="delivery-item" v-for="(itemC,indexC) in good_list" :key="indexC">
                <img class="item-img" :src="itemC.good_pics"  />
                <div class="item-right">
                    <div class="item-flex">
                        <div class="item-des">{{ itemC.good_name }}</div>
                        <div class="item-price">
                            <span class="price-icon">¥</span>
                            <span>{{ itemC.good_base_price_arr.z_price }}</span>
                            <span class="price-small">.{{ itemC.good_base_price_arr.x_price }}</span>
                        </div>
                    </div>
                    <div class="item-circle">{{ itemC.good_unit }}</div>
                    <div class="item-txt">数量：<span class="txt-num">x{{ itemC.refund_num }}</span></div>
                    <div class="item-txt txt-nomar">单价：<span class="txt-icon">¥</span>{{ itemC.good_base_price_arr.z_price }}<span class="txt-small">.{{ itemC.good_base_price_arr.x_price }}</span></div>
                </div>
            </div>
        </div>

        <div class="price">
			<div class="price-right">
				<!-- <van-button class="refund-btn">联系财务</van-button> -->
			</div>
            <div class="price-right">
				<van-button class="price-btn" @click="refundOrder">退款订单</van-button>
			</div>
		</div>

    </div>
</template>
<script>
import { refundOrderInfo } from "@/api/cloud";
export default {
    data() {
        return {
			refund_id: '',
			info: {},
            good_list: []
        }
    },
    mounted() {
		this.refund_id = this.$route.query.id;
        this.refundOrderInfo();
    },
    methods: {
		async refundOrderInfo() {
			const res = await refundOrderInfo({
				order_id: this.refund_id
			})
			if (res.status == 1) {
				this.info = res.data.orderinfo;
				this.good_list = res.data.refund_list;
			}
		},
        onClickLeft() {
            this.$router.back();
        },
        refundOrder() {
            this.$router.push({
				path: '/orderDetail',
				query: {
					id: this.info.id
				}
			})
        }
    },
}
</script>
<style lang="less" scoped>
.pages {
    padding-top: calc(92px + 24px);
    padding-bottom: 108px;
    min-height: 100vh;
    background: #F6F6F6;

    ::v-deep .van-nav-bar .van-icon {
        color: #323233;
    }

    ::v-deep .van-nav-bar {
        background: #FFFFFF;
    }

    ::v-deep .van-hairline--bottom::after {
        border: none;
    }
}

.info{
	width: 702px;
	padding: 32px 32px 6px;
	background: #FFFFFF;
	border-radius: 16px;
    margin: 0 auto 30px;
	.info-title{
		font-size: 32px;
		line-height: 32px;
		color: #141414;
		font-weight: bold;
		margin-bottom: 48px;
	}
	.info-flex{
		display: flex;
        justify-content: space-between;
		align-items: center;
		margin-bottom: 40px;
	}
	.info-name{
		font-size: 28px;
		line-height: 28px;
		font-weight: 400;
		color: #141414;
        margin-right: 36px;
	}
	.info-price{
		font-size: 28px;
		line-height: 28px;
		color: #798391;
		font-weight: 400;
		.price-icon{
			font-size: 24px;
			margin-right: 2px;
            font-weight: bold;
            color: #666666;
		}
	}
    .info-img{
        flex-shrink: 0;
        display: block;
        width: 32px;
        height: 32px;
        margin-left: 20px;
    }
	.info-type{
		display: flex;
		align-items: center;
		font-size: 28px;
		line-height: 28px;
		color: #798391;
		font-weight: 400;
		.type-img{
			display: block;
			width: 28px;
			height: 28px;
			margin-right: 16px;
		}
	}
}

.delivery{
    width: 702px;
    padding-bottom: 36px;
	background: #FFFFFF;
	border-radius: 16px;
    margin: 0 auto 24px;
	.delivery-title{
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 646px;
		height: 98px;
		font-size: 32px;
		line-height: 32px;
		font-weight: bold;
		color: #141414;
		border-bottom: 2px solid #F5F5F6;
		margin:0 auto 24px;
        .title-right{
            font-size: 24px;
            line-height: 32px;
            color: #798391;
            font-weight: 400;
            .right-price{
                font-size: 32px;
                line-height: 32px;
                color: #49CA6F;
                font-weight: bold;
            }
        }
	}
	.title-txt{
		font-size: 24px;
		line-height: 24px;
		color: #798391;
		font-weight: 400;
	}
	.delivery-item{
		display: flex;
		padding-left: 26px;
		padding-right: 22px;
		margin-bottom: 16px;
		.item-img{
			flex-shrink: 0;
			display: block;
			width: 220px;
			height: 220px;
			border-radius: 8px;
			margin-right: 24px;
		}
		.item-right{
			flex: 1;
			flex-shrink: 0;
		}
		.item-flex{
			display: flex;
			justify-content: space-between;
			margin-bottom: 10px;
		}
		.item-des{
			display: -webkit-box;
			-webkit-line-clamp: 2;
			-webkit-box-orient: vertical;
			overflow: hidden;
			text-overflow: ellipsis;
			flex-shrink: 0;
			width: 282px;
			font-size: 28px;
			line-height: 40px;
			color: #333333;
			font-weight: 400;
		}
		.item-price{
			font-size: 40px;
			line-height: 40px;
			color: #141414;
			font-weight: bold;
			.price-icon{
				font-size: 24px;
			}
			.price-small{
				font-size: 28px;
			}
		}
		.item-circle{
			width: fit-content;
			padding: 0px 6px;
			margin-right: 6px;
			margin-bottom: 14px;
			font-size: 20px;
            line-height: 24px;
			color: #FFFFFF;
			background: #49CA6F;
			border-radius: 4px;
		}
		.item-txt{
			font-size: 24px;
			line-height: 34px;
			font-weight: 400;
			color: #798391;
			margin-bottom: 14px;
		}
		.txt-icon{
			font-size: 20px;
		}
		.txt-small{
			font-size: 20px;
		}
		.txt-num{
			color: #FF4D4F;
		}
		.txt-nomar{
			margin-bottom: 0;
		}
	}
	.delivery-more{
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 24px;
		line-height: 40px;
		font-weight: 400;
		color: #798391;
		padding-top: 20px;
		padding-bottom: 12px;
		.more-img{
			display: block;
			width: 32px;
			height: 32px;
		}
		.more-back{
			transform: rotate(180deg);
		}
	}
}

.price{
	position: fixed;
    left: 0;
    bottom: 0;
	display: flex;
	justify-content: flex-end;
    width: 100vw;
    padding-top: 19px;
	padding-left: 56px;
	padding-right: 28px;
    padding-bottom: calc(20px + constant(safe-area-inset-bottom)); /* 兼容 iOS<11.2 */
    padding-bottom: calc(20px + env(safe-area-inset-bottom)); /* 兼容iOS>= 11.2 */
    background: #FFFFFF;
	.price-right{
		display: flex;
		align-items: center;
		.price-btn{
			flex-shrink: 0;
			display: block;
			width: 216px;
			height: 72px;
			background: #49CA6F;
			border-radius: 39px;
			font-size: 32px;
			line-height: 72px;
			color: #FFFFFF;
			font-weight: 500;
			border:none;
			margin-left: 14px;
		}
		.price-btn::after{
			border:none;
		}
		.refund-btn{
			width: 216px;
			height: 72px;
			border: 2px solid #49CA6F;
			font-size: 32px;
			line-height: 68px;
			color: #49CA6F;
			font-weight: 500;
			border-radius: 39px;
			background: #FFFFFF;
		}
	}
}
</style>